<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<%--
  Created by IntelliJ IDEA.
  User: 董灌磊
  Date: 2024/4/12
  Time: 18:55
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="/webjars/layui/2.6.8/css/layui.css">
    <script src="/webjars/layui/2.6.8/layui.js"></script>
</head>
<body>
<div class="layui-container">
    <div class="layui-form" id="searchForm" lay-filter="searchForm">
        <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">租户:</label>
            <div class="layui-input-inline">
                <input type="text" name="subletname" placeholder="租户" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">租户手机号:</label>
            <div class="layui-input-inline">
                <input type="text" name="subletphone" placeholder="租户手机号" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">身份证号:</label>
            <div class="layui-input-inline">
                <input type="text" name="subletcard" placeholder="租户身份证号" class="layui-input">
            </div>
        </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">租户地址:</label>
                <div class="layui-input-inline">
                    <input type="text" name="subletaddress" placeholder="租户地址" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <button class="layui-btn" onclick="search()" >查询</button>
            </div>
        </div>
    </div>
</div>
<table id="houseTable" lay-filter="houseTables"  class="layui-table layui-table-hover"></table>
<script>
    var $ =layui.$
    layui.use(function (){
        let table=layui.table;
        table.render({
            id:"one",
            elem:"#houseTable",
            url:'/property/zucount/show',
            page:true,
            cols:[[
                {field:'number',align: 'center',type:'numbers',title:"编号"},
                {field:'id',align: 'center',hide:true,title:"序号"},
             {field:'plotid',align: 'center',title:"小区名",templet(r){
                        return r.house.plot.plotname;
                    }},
                  {field:'cell',align: 'center',title:"具体地址",templet(r) {
                        return r.house.floormanager.floorname+r.house.cell+r.house.floornum+r.house.houseid
                    }},
                {field:'',align: 'center',title:"房屋状态",templet(r) {
                        return r.house.storestate==null?"-":r.house.storestate.statename;
                    }},
                {field:'userid',title:"甲方",templet(r) {
                        return r.house.owners== null?"-" : r.house.owners.ownername;
                    }},
                {field:'subletname',align: 'center',title:"乙方"},
                {field:'subletaddress',align: 'center',title:"租户地址"},
                {field:'subletmoney',align: 'center',title:"租金"},
                {field:'yamoney',align: 'center',title:"押金"},
                {field:'endtime',align: 'center',title:"到期时间",templet(r){
                        return r.endtime+"到期";
                    }},
            ]]
        })
    })
    //点击去查询
    function search(){
        //获取表单的值,表单序列化
        var where = layui.form.val('searchForm');
        console.log(where)
        //条件查询，重载表格因为键和值都是where，所以可以值保留键
        layui.table.reload('one',{where});
    }
</script>
</body>
</html>
